package com.obrempon.credit.market.sdk.device.util

import android.content.Context
import android.content.pm.PackageManager

fun Context.checkPermissionsGranted(list: List<String>): Boolean {
    return !list.any {
        checkSelfPermission(it) != PackageManager.PERMISSION_GRANTED
    }
}

fun String?.safe(): String {
    if (this.isNullOrBlank()) return ""
    return this
}

fun String?.safeInt(): Int {
    if (this.isNullOrBlank()) return 0
    return this.toInt()
}

fun String?.safeLong(): Long {
    if (this.isNullOrBlank()) return 0
    return this.toLong()
}

fun String.lastPath(): String {
    return replace("/", "")
}


